package cn.good.yan.apis;

import cn.good.yan.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 演示：分布式事务
 * 调用 axx - 进行扣减该用户的账户的金额
 *
 * @author shengren.yan
 * @create 2024-04-13
 */
@FeignClient(value = "seata-axx-service")
public interface AxxFeignApi {

    /**
     * 扣减账户余额
     * 根据用户id，扣除的金额
     *
     * @param userId
     * @param money
     * @return {@link ResultData}
     */
    @PostMapping("/axx/decrease")
    ResultData decrease(@RequestParam("userId") Long userId,
                        @RequestParam("money") Long money);

}
